﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class sy_Admin_Manage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        AdminCs.CheckLoginState();
        if (!this.IsPostBack)
        {

            SqlConnection conn = Class1.DBconnection();
            conn.Open();
            SqlCommand cmd = new SqlCommand("select * from SyAdmin", conn);
            SqlDataReader sdr = cmd.ExecuteReader();
            Repeater1.DataSource = sdr;
            Repeater1.DataBind();
            sdr.Close();

            if (Request["Id"] != null && Request["del"] != null)
            {
                int Admin_Id = int.Parse(Request.QueryString["Id"]);
                string deladmin = "delete from SyAdmin where Admin_Id=" + Admin_Id + "";
                Class1.ExecSql(deladmin);
                Response.Write("<script language=javascript>alert('删除成功！');window.location='Admin_Manage.aspx';</script>");
            }
            conn.Close();
            conn.Dispose();
            cmd.Dispose();
            
        }
    }
}
